// src\main.js
import { createApp } from 'vue'
// import './style.css'
import App from './App.vue'
import router from './router'
import {Button, Field, Form, Icon, Skeleton, Swipe, SwipeItem, Tabs, Tab, PullRefresh, List, ActionBar, ActionBarIcon,ActionBarButton, AddressEdit, AddressList, CheckboxGroup, Stepper, SubmitBar, Popup, Card, Checkbox, SwipeCell} from 'vant' //引入Button组件
import 'lib-flexible'   //引入适配rem文件
import store from './store' //引入 store 实例

const app = createApp(App)  //生成实例

app.use(router)
app.use(store)

app
  .use(Button)
  .use(Icon)
  .use(Form)
  .use(Field)
  .use(Skeleton)
  .use(Swipe)
  .use(SwipeItem)
  .use(Tabs)
  .use(Tab)
  .use(PullRefresh)
  .use(List)
  .use(ActionBar)
  .use(ActionBarIcon)
  .use(ActionBarButton)
  .use(AddressEdit)
  .use(AddressList)
  .use(CheckboxGroup)
  .use(Stepper)
  .use(SubmitBar)
  .use(Popup)
  .use(Card)
  .use(Checkbox)
  .use(SwipeCell)

// 全局过滤器，图片不是本服务器的，所以需要做处理
app.config.globalProperties.$filters = {
  prefix(url) {
    if (url && url.startsWith('http')) {
      return url
    } else {
      url = `http://localhost:8080${url}`
      return url
    }
  }
}

app.mount('#app')           //挂载实例